<div class="dashboard">
  <div class="row hidden-xs">
      <div class="col-md-4 col-sm-6">
          <div class="dashboard-tile detail tile-turquoise">
              <div class="content">
                  <h1 class="text-left timer"><%= @counts[:page] %></h1>
                  <% if @counts[:page] > 1 %>
                    <p><%= t("generic.pages") %></p>
                  <% else %>
                    <p><%= t("generic.page") %></p>
                  <% end %>
              </div>
              <div class="icon"><i class="fa fa-files-o"></i>
              </div>
          </div>
      </div>
      <div class="col-md-4 col-sm-6">
          <div class="dashboard-tile detail tile-turquoise">
              <div class="content">
                  <h1 class="text-left timer"><%= @counts[:post] %></h1>
                  <% if @counts[:post] > 1 %>
                    <p><%= t("generic.articles") %></p>
                  <% else %>
                    <p><%= t("generic.article") %></p>
                  <% end %>
              </div>
              <div class="icon"><i class="fa fa-file-text-o"></i>
              </div>
          </div>
      </div>
      <div class="col-md-4 col-sm-6">
          <div class="dashboard-tile detail tile-turquoise">
              <div class="content">
                  <h1 class="text-left timer"><%= @counts[:comments] %></h1>
                  <% if @counts[:comments] == 1 %>
                    <p><%= t("generic.unseen_comment") %></p>
                  <% else %>
                    <p><%= t("generic.unseen_comments") %></p>
                  <% end %>
              </div>
              <div class="icon"><i class="fa fa fa-comments"></i>
              </div>
          </div>
      </div>
  </div>

  <% size = @comments.blank? ? '12' : '6' %>

  <div class="row">
      <div class="col-md-<%= size %>">
        <% cache('admin_quick_links') do %>
          <div class="panel panel-default">
              <div class="panel-heading">
                  <h3 class="panel-title"><%= t("views.admin.dashboard.quick_links") %></h3>
                  <div class="actions pull-right">
                      <i class="fa fa-chevron-down"></i>
                  </div>
              </div>
              <div class="panel-body">

                  <div class=" shortcuts">
                      <% if check_controller_against_user('pages') %>
                        <div class="col-md-4 col-sm-6">
                          <%= link_to admin_pages_path, :class => 'shortcut' do %>
                            <i class="fa fa-file fa-4x"></i>
                            <span class="shortcut-label"><%= t("generic.pages") %></span>
                          <% end %>
                        </div>
                      <% end %>
                      <% if check_controller_against_user('articles') %>
                        <div class="col-md-4 col-sm-6">
                          <%= link_to admin_articles_path, :class => 'shortcut' do %>
                            <i class="fa fa-file-o fa-4x"></i>
                            <span class="shortcut-label"><%= t("generic.articles") %></span>
                          <% end %>
                        </div>
                      <% end %>
                      <% if check_controller_against_user('administrators') %>
                        <div class="col-md-4 col-sm-6">
                          <%= link_to admin_administrators_path, :class => 'shortcut' do %>
                            <i class="fa fa-user fa-4x"></i>
                            <span class="shortcut-label"><%= t("views.admin.dashboard.administrators") %></span>
                          <% end %>
                        </div>
                      <% end %>
                      <% if check_controller_against_user('settings') %>
                        <div class="col-md-4 col-sm-6">
                          <%= link_to admin_settings_path, :class => 'shortcut' do %>
                            <i class="fa fa-cogs fa-4x"></i>
                            <span class="shortcut-label"><%= t("generic.settings") %></span>
                          <% end %>
                        </div>
                      <% end %>
                      <% if check_controller_against_user('menus') %>
                        <div class="col-md-4 col-sm-6">
                          <%= link_to admin_menus_path, :class => 'shortcut' do %>
                            <i class="fa fa-list fa-4x"></i>
                            <span class="shortcut-label"><%= t("generic.menus") %></span>
                          <% end %>
                        </div>
                      <% end %>
                      <% if check_controller_against_user('trash') %>
                        <div class="col-md-4 col-sm-6">
                          <%= link_to admin_trash_index_path, :class => 'shortcut' do %>
                            <i class="fa fa-trash-o fa-4x"></i>
                            <span class="shortcut-label"><%= t("generic.trash") %></span>
                          <% end %>
                        </div>
                      <% end %>
                </div>
              </div>
          </div>
        <% end %>
      </div>
      <% if !@comments.blank? %>
        <div class="col-md-<%= size %> comments">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><%= t("views.admin.dashboard.latest_5_comments") %></h3>
                    <div class="actions pull-right">
                        <i class="fa fa-chevron-down"></i>
                    </div>
                </div>
                <div class="panel-body">
                    <ul class="list-group">
                      <% @comments.each do |comment| %>
                        <li class="list-group-item">
                            <div class="pull-left">
                              <strong><%= comment.author %></strong><br />
                              <small><%= create_excerpt(comment.comment, 50) %></small>
                            </div>
                            <div class="pull-right action-buttons">
                              <div class="btn-group pull-right">
                                <%= link_to edit_admin_comment_path(comment), :class => 'btn btn-xs btn-default' do %>
                                  <i class="fa fa-pencil"></i>
                                <% end %>
                                 <%= link_to mark_as_spam_admin_comment_path(comment), :class => 'btn btn-xs btn-default' do %>
                                  <i class="fa fa-fire"></i>
                                <% end %>              
                                <%= link_to admin_comment_path(comment), method: :delete, data: { confirm: t("views.admin.generic.confirm") }, :class => 'btn btn-xs btn-danger' do %>
                                  <i class="fa fa-trash-o"></i>
                                <% end %>
                              </div>
                            </div>
                            <div class="clearfix"></div>
                        </li>

                      <% end %>
                    </ul>
                </div>
            </div>
        </div>
      <% end %>
  </div>
</div>

